<?php
/**
 * 友情链接新增修改
 * User: hgq
 * Date: 2016/7/8 0008
 * Time: 下午 16:56
 */
?>
<div>
    <?php
    if ($detail != '') {
        ?>
        <form class="form-inline" role="form">
            <div class="form-group">
                <input type="hidden" id="edit_id" class="form-control" value="<?= $detail["id"] ?>" disabled>
                <input type="hidden" id="edit_institution_code" class="form-control"
                       value="<?= $detail["institution_code"] ?>" disabled>

                <label for="exampleInputPassword2">链接名称：</label>
                <input type="text" id="edit_name" class="form-control" value="<?= $detail["name"] ?>" style=" width: 193px">

                <label for="exampleInputPassword2">所属分类：</label>
                <select id="edit_category_id" class="form-control" style=" width: 200px" onchange="">
                    <?php
                    if ($category != null && $category != '') {
                        for ($i = 0; $i < count($category); $i++) {
                            ?>
                            <option
                                value="<?= $category[$i]['id'] ?>" <?php if ($detail["category_id"] == $category[$i]['id']) echo "selected=\"selected\""; ?>><?= $category[$i]['name'] ?></option>
                            <?php
                        }
                    }
                    ?>
                </select>
            </div>
            <div class="form-group" style=" margin-top: 3px">
                <label for="exampleInputPassword2">链接地址：</label>
                <input type="text" id="edit_link_url" class="form-control" style="width: 470px;"
                       value="<?= $detail["link_url"] ?>">
            </div>
            <div class="form-group" style=" margin-top: 3px">
                <label for="exampleInputPassword2">是否显示：</label>
                <select id="edit_is_shown" class="form-control" style=" width: 200px" onchange="">
                    <option value="1" <?php if ($detail["is_shown"] == "1") echo "selected=\"selected\""; ?>>显示
                    </option>
                    <option value="0" <?php if ($detail["is_shown"] == "0") echo "selected=\"selected\""; ?>>不显示
                    </option>
                </select>
            </div>
        </form>
        <?php
    } else {
        ?>
        <form class="form-inline" role="form">
            <div class="form-group">
                <input type="hidden" id="edit_id" class="form-control" value="" disabled>
                <input type="hidden" id="edit_institution_code" class="form-control"
                       value="<?= $institution_code ?>" disabled>

                <label for="exampleInputPassword2">链接名称：</label>
                <input type="text" id="edit_name" class="form-control" value="" style=" width: 193px">

                <label for="exampleInputPassword2">所属分类：</label>
                <select id="edit_category_id" class="form-control" style=" width: 200px" onchange="">
                    <?php
                    if ($category != null && $category != '') {
                        for ($i = 0; $i < count($category); $i++) {
                            ?>
                            <option
                                value="<?= $category[$i]['id'] ?>"><?= $category[$i]['name'] ?></option>
                            <?php
                        }
                    }
                    ?>
                </select>
            </div>
            <div class="form-group" style=" margin-top: 3px">
                <label for="exampleInputPassword2">链接地址：</label>
                <input type="text" id="edit_link_url" class="form-control" style="width: 470px;">
            </div>
            <div class="form-group" style=" margin-top: 3px">
                <label for="exampleInputPassword2">是否显示：</label>
                <select id="edit_is_shown" class="form-control" style=" width: 200px" onchange="">
                    <option value="1" selected="selected">显示</option>
                    <option value="0">不显示</option>
                </select>
            </div>
        </form>
        <?php
    }
    ?>
</div>
